package com.little.pattern.observer;

/**
 * Created by littleshu on 18/5/5.
 */
public class Main {
    public static void main(String[] args) {
        XiaoMing xiaoMing = new XiaoMing();
        XiaoHong xiaoHong = new XiaoHong();
        XiaoZhang xiaoZhang = new XiaoZhang();

        System.out.println("语文课上，老师在讲课");
        System.out.println("------------------");

        System.out.println("小红跟小明说老师下来了告诉我，我看小说去了");
        xiaoHong.tell(xiaoMing);

        System.out.println("小张跟小明说老师下来了告诉我，我睡觉去了");
        xiaoZhang.tell(xiaoMing);

        System.out.println("------------------");

        System.out.println("老师走下讲台");
        System.out.println("小明通知小张与小红");
        xiaoMing.notifyObserver();


    }
}
